package com.softeem.hello.service;

import com.softeem.hello.dao.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import  java.util.Objects;
import java.util.List;

@Service
public class UserServiceImpl implements UserService{

    @Autowired
    private UserMapper userMapper;

    @Override
    public boolean login(String username, String password) {
        User u=userMapper.selectByUsername(username);
        if(Object.nonNull(u))&& Objects.equals(password,u.getPassword())) {
            return true;
        }return false;
    }

    @Override
    public boolean modify(Integer id, String pwd) {
        return false;
    }

    @Override
    public boolean registry(User user) {
        User u =userMapper.selectByUsername((user.getUsername()));
        if(Objects.nonNull(u)){
        return false;
    }
    return  userMapper.insert(user);
    }

    @Override
    public boolean remove(Integer id) {
        return false;
    }
}
